- 
                Notifications
    You must be signed in to change notification settings 
- Fork 68
🐛 short-circuit reconcile when objects are deleted #2022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 short-circuit reconcile when objects are deleted #2022
Conversation
This is necessary to ensure that we do not keep reconciling the objects as if they were not deleted. The need for this became apparent while trying to use --cascade=orphan with a ClusterExtension. In theory, that should work out of the box because, we set owner references on all managed objects. However, that was not working because our controller was fully reconciling objects with metadata.finalizers: ["orphan"], which was writing owner references back into the objects that the orphan deletion process had just removed. Ultimately this meant that the managed objects would be background deleted because they once again had an owner reference to the now-deleted ClusterExtension, which then caused the kubernetes garbage collector to clean them up. In general, it stands to reason that once we have successfully processed all of our finalizers after a deletion of an object, we should stop reconciling that object. Signed-off-by: Joe Lanford <[email protected]>
| ✅ Deploy Preview for olmv1 ready!
 To edit notification comments on pull requests, go to your Netlify project configuration. | 
| /approve | 
| /lgtm | 
| [APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tmshort The full list of commands accepted by this bot can be found here. The pull request process is described here 
Needs approval from an approver in each of these files:
 
 Approvers can indicate their approval by writing  | 
| Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@            Coverage Diff             @@
##             main    #2022      +/-   ##
==========================================
+ Coverage   69.17%   69.26%   +0.08%     
==========================================
  Files          79       79              
  Lines        7037     7051      +14     
==========================================
+ Hits         4868     4884      +16     
+ Misses       1887     1885       -2     
  Partials      282      282              
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
 | 
b152c7b
      into
      
  
    operator-framework:main
  
    
Description
This is necessary to ensure that we do not keep reconciling the objects as if they were not deleted.
The need for this became apparent while trying to use --cascade=orphan with a ClusterExtension. In theory, that should work out of the box because, we set owner references on all managed objects.
However, that was not working because our controller was fully reconciling objects with metadata.finalizers: ["orphan"], which was writing owner references back into the objects that the orphan deletion process had just removed.
Ultimately this meant that the managed objects would be background deleted because they once again had an owner reference to the now-deleted ClusterExtension, which then caused the kubernetes garbage collector to clean them up.
In general, it stands to reason that once we have successfully processed all of our finalizers after a deletion of an object, we should stop reconciling that object.
Reviewer Checklist